<?php
class Model_Product {
	protected $_id;
	protected $_name;
	protected $_price;
	protected $_unit;
	static protected $_products;
	static protected $_priceOpts;
	public static function getPriceOpts(){
		Model_Product::$_priceOpts = array(30=>'ธรรมดา 30 บาท ',40=>'พิเศษ 40 บาท');
		return Model_Product::$_priceOpts;
	}
	
	public static function  initModel(){
			Model_Product::$_products =  array(
			new Model_Product(1,"ผัดไทย", "ห่อ")
			,new Model_Product(2,"หอยทอด", "ห่อ")
			,new Model_Product(3,"ส้มตำไทย","ถุง")
			,new Model_Product(4,"ส้มตำปูปลาร้า","ถุง")
		);
		return Model_Product::$_products;
	}
	public static function getProductById($id){
		foreach(Model_Product::$_products as $key=>$value){
			if($value->getId() == $id)
				return $value;
		}
	}
	public function __construct($id,$name,$unit){
		$this->_id = $id;
		$this->_name = $name;
		$this->_unit = $unit;
	}
	
	public function getId(){
		return $this->_id;
	}
	public function getName(){
		return $this->_name;
	}
	
	public function getUnit(){
		return $this->_unit;
	}
}
?>